import { createRouter, createWebHistory } from "vue-router";
import BLogin from "../views/BLogin.vue";
import BHome from "../views/BHome.vue";
import ErrorMessage from "../views/ErrorMessage.vue";
import SearchInput from "../components/children/SearchInput.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: "/", redirect: "/blogin" },
    {
      path: "/blogin",
      name: "BLogin",
      component: BLogin,
    },
    {
      path: "/bhome",
      name: "Bhome",
      component: BHome,
      meta: {
        requiresAuth: true,
      },
    },
    {
      path: "/searchinput/:value",
      component: SearchInput,
      name: "searchinput",
    },
    {
      path: "/:pathMatch(.*)*",
      component: ErrorMessage,
    },
  ],
});

export default router;
